/* 
 * Enterprise Library Extensions - DI + ORM.
 * Copyright (C) 2006
 *
 * GNU General Public License
 *
 * This program is free software; you can redistribute 
 * it and/or modify it under the terms of the GNU General Public License 
 * as published by the Free Software Foundation; either version 2 of the 
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but 
 * WITHOUT ANY WARRANTY; without even the implied warranty of 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
 * See the GNU General Public License for more details.
 */
using System;
using System.Collections;

namespace ELE.EnterpriseLibrary.Naming.Spi
{
	/// <summary>
  /// This interface represents a builder that creates object factories. 
  /// <br/><br/>The ONDI framework allows for object implementations to be loaded in dynamically via object factories. 
  /// For example, when looking up a printer bound in the name space, if the print service binds printer names to 
  /// References, the printer Reference could be used to create a printer object, so that the caller of lookup can 
  /// directly operate on the printer object after the lookup. An ObjectFactory is responsible for creating objects 
  /// of a specific type. ONDI uses a default policy for using and loading object factories. You can override this 
  /// default policy by calling NamingManager.SetObjectFactoryBuilder() with an IObjectFactoryBuilder, which contains 
  /// the program-defined way of creating/loading object factories. Any IObjectFactoryBuilder implementation must 
  /// implement this interface that for creating object factories. 
	/// </summary>
	public interface IObjectFactoryBuilder
	{
    /// <summary>
    /// Creates a new object factory using the environment supplied. 
    /// <br/>The environment parameter is owned by the caller. The implementation will not modify the object or keep a 
    /// reference to it, although it may keep a reference to a clone or copy.
    /// </summary>
    /// <param name="obj">The possibly null object for which to create a factory.</param>
    /// <param name="environment">environment - Environment to use when creating the factory. Can be null.</param>
    /// <returns>A non-null new instance of an ObjectFactory.</returns>
    IObjectFactory CreateObjectFactory(object obj, Hashtable environment);
      
	}
}
